package top.kent90.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;
import top.kent90.common.object.Result;
import top.kent90.dao.SysUserDao;
import top.kent90.pojo.SysUser;

import java.util.List;
import java.util.Map;
@Service
public class SysUserServiceImpl implements SysUserService {
    @Autowired
    SysUserDao dao;
    @Override
    public Result querySysUser(Map<String, Object> map,String pageNum,String pageSize) {
        PageHelper.startPage(Integer.parseInt(pageNum),Integer.parseInt(pageSize));
        List<SysUser> sysList =dao.querySysUser(map);
        PageInfo pg = new PageInfo(sysList);
        return new Result("0","",pg.getTotal(),pg.getList());
    }

    @Override
    public List<Map<String, Object>> queryRoles(String userId) {
        List<Map<String, Object>> roles =  dao.queryRoles(userId);
        return roles;
    }
}
